package com.maori.languageapp;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPReply;
import android.app.ProgressDialog;
import android.util.Log;
import android.widget.ProgressBar;

public class UploadToFtpAudio {
	private static final String TAG = null;
	public FTPClient mFTPClient = null;

	public boolean ftpUpload1(String srcFilePath, String desFileName,
			String desDirectory) {
		String host = "langapp.mirzabros.com";
		String username = "lanappaudio@langapp.mirzabros.com";
		String password = "213066";
		int port = 21;
		mFTPClient = new FTPClient();
		boolean status = false;
		try {

			mFTPClient.connect(host, port);
			mFTPClient.login(username, password);
			mFTPClient.changeWorkingDirectory("http://langapp.mirzabros.com/lanappaudio/"); 

			
			mFTPClient.setFileType(FTP.BINARY_FILE_TYPE);
			BufferedInputStream buffIn = null;
			File file = new File(srcFilePath + desFileName);
			Log.v(TAG, "File : " +file);
			buffIn = new BufferedInputStream(new FileInputStream(file), 8192);
			mFTPClient.enterLocalPassiveMode();
			status = mFTPClient.storeFile(desFileName, buffIn);

			buffIn.close();
			mFTPClient.logout();
			mFTPClient.disconnect();

		} catch (Exception e) {
			Log.v(TAG, "Exception : " + e);
			e.printStackTrace();
		}
		return status;
	}
}